﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace Infrastructure.WpfClient.ValidationRules
{
    public class EmptyStringRule : ValidationRule
    {

        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            if (value == null)
            {
                return new ValidationResult(false, "cannot be null");  
            }
            else if (string.IsNullOrWhiteSpace(value.ToString()) == true)
            {
                return new ValidationResult(false, "cannot be null");  
            }
            else
            {
                return new ValidationResult(true, null);
            }
        }
    }
}
